function q = model_quantile(x,f,prob)

    [x,idx] = sort(x);
    q = x(find(cumsum(f(idx))/sum(f) >= (1-prob), 1));

end